﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Control.Bus;

namespace QuanLyKho
{
    public partial class FormMain : Form
    {
        public FormMain()
        {
            InitializeComponent();
        }
        BusStaff Staff = new BusStaff()
        {
            ID = 1,
            UserName = "admin",
            PassWord = "admin",
        };
        private void btNhapmoi_Click(object sender, EventArgs e)
        {
            Form1 frm = new Form1();
            frm.Show();
        }

        private void btDangNhap_Click(object sender, EventArgs e)
        {
            FrmLogin frm = new FrmLogin();
            frm.ShowDialog();
            Staff = frm.Staff;
            LoadForm();
        }

        private void LoadForm()
        {
           
        }

        private void BtThoat_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btDangXuat_Click(object sender, EventArgs e)
        {
            Staff = new BusStaff();
            LoadForm();
        }

        private void FormMain_Load(object sender, EventArgs e)
        {
            LoadForm();
        }

        private void btnXuat_Click(object sender, EventArgs e)
        {
            BusExportBill Bill = BusExportBill.GetBillThuongByDateAndStaff(DateTime.Now, Staff);
            if (Bill.ID == -1)
            {
                Bill.Date=DateTime.Now;
                Bill.Staff=Staff;
                Bill.BillName="Thường";
                Bill.BillCode = null;
                Bill.Insert();
            }
            FrmExport frm = new FrmExport(Bill, Staff);
            frm.Show();
        }

        private void btXuatBO_Click(object sender, EventArgs e)
        {

            FrmXuatBO frm = new FrmXuatBO(DateTime.Now, this.Staff);
            frm.Show();
        }

        private void btQuanLyXuat_Click(object sender, EventArgs e)
        {
            FrmQuanLyXuat frm = new FrmQuanLyXuat(Staff);
            frm.Show();
        }

        private void btQLPhieuNhap_Click(object sender, EventArgs e)
        {
            FrmQuanLyNhap frm = new FrmQuanLyNhap(this.Staff);
            frm.Show();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            FrmBaoCaoTonKho frm = new FrmBaoCaoTonKho();
            frm.Show();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            FrmBaoCaoNhap frm = new FrmBaoCaoNhap("", DateTime.Now, DateTime.Now);
            frm.Show();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            frmBaoCaoXuat frm = new frmBaoCaoXuat("", DateTime.Now, DateTime.Now);
            frm.Show();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            FrmQuanLySP frm = new FrmQuanLySP();
            frm.Show();
        }

        private void button5_Click(object sender, EventArgs e)
        {
            FrmQLKe frm = new FrmQLKe();
            frm.Show();
        } 


    }
}
